package com.innerclass;

public class MainExample {

	private String name = "zhangdong";

	public void test() {
		System.out.println("father test methond");
	}

	private class test1 extends Example1 {
		public String name() {
			test();
			System.out.println(name);
			return super.name();
		}
	}

	private class test2 extends Example2 {
		public int age() {
			test();
			return super.age();
		}
	}

	private class test3 implements DuplicateNameInterface {
		@Override
		public void test() {
			System.out.println("Implement test methond from interface");
		}
	}

	public String name() {
		return new test1().name();
	}

	public int age() {
		return new test2().age();
	}

	public void invokeSameNameMethod() {
		//Two same name method in a class
		this.test();
		new test3().test();
	}

	public static void main(String args[]) {
		MainExample mi = new MainExample();
		System.out.println("姓名:" + mi.name());
		System.out.println("年龄:" + mi.age());
		mi.invokeSameNameMethod();
	}
}